package blazingbubble.game.command.net;

import blazingbubble.command.NetworkCommand;
import blazingbubble.game.command.CannonRotateStartCommand;
import blazingbubble.game.command.JoinTeamCommand;
import moltencore.network.protocol.JoinTeam;
import moltencore.network.protocol.ReadyToPlay;
import spark.math.Random;
import spark.network.NetworkConnection;
import spark.network.Sender;
import spark.network.protocol.PreLogin;

public class NetJoinTeamCommand extends JoinTeamCommand {
	private NetworkCommand networkCommand;

	private int teamIndex;
	private int slotIndex;

	void startupNetworkingAbility(Sender sender, NetworkConnection serverConnection) {
		networkCommand = new NetworkCommand(sender, serverConnection);
	}

	@Override
	public void join() {
		JoinTeam packet = new JoinTeam();
		packet.setSlotIndex(slotIndex);
		packet.setTeamIndex(teamIndex);
		networkCommand.send(packet);
	}

	@Override
	public void setTeamIndex(int teamIndex) {
		this.teamIndex = teamIndex;
	}

	@Override
	public void setSlotIndex(int slotIndex) {
		this.slotIndex = slotIndex;
	}
}
